<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="com.model.Admin" %>  
<%@ page import="com.control.AdminControl" %>  
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
request.setCharacterEncoding("UTF-8");
String admin_num=request.getParameter("number");
String admin_pwd=request.getParameter("password");
String admin_name=request.getParameter("name");
String admin_sex=request.getParameter("sex");
String admin_tel=request.getParameter("tel");
int admin_building_id=Integer.parseInt(request.getParameter("building"));
Admin a=new Admin();
AdminControl ac=new AdminControl();
a.setAdmin_num(admin_num);
a.setAdmin_pwd(admin_pwd);
a.setAdmin_name(admin_name);
a.setAdmin_sex(admin_sex);
a.setAdmin_tel(admin_tel);
a.setAdmin_building_id(admin_building_id);
if(ac.insertAdmin(a))
{
	%>
	<script>
	if(window.confirm("添加成功，是否继续添加管理员？"))
		window.location.href="admin_insert.jsp";
	else
		window.location.href="adminInfo_show.jsp";
	</script>
	<%}else{ %>
	<script>
	alert("添加失败！");
	window.location.href="adminInfo_show.jsp";
	</script>
	<%} %>
</body>
</html>